# -*- coding:utf-8 -*-
# @Time:2024/4/1921:01
# @Author:miuzg
# @FileName:new test2.py
# @Software:PyCharm

import time
from multiprocessing import Pool# 之前的写法
from concurrent.futures import ProcessPoolExecutor# 和上面类似，但是在并发处理提供的方法更多


def work(url):
    time.sleep(3)
    print(url)

if __name__ == '__main__':
    pool = ProcessPoolExecutor(4)
    url_list = ['www.xx{}.com'.format(i) for i in range(12)]
    for url in url_list:
        pool.submit(work,url)